package net;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class UseNet {

    public static void main(String[] args) throws UnknownHostException {
        InetAddress localHost = InetAddress.getLocalHost();
        System.out.println(localHost.getHostAddress()); //本机ip地址
        System.out.println(localHost.getHostName()); //本地名字
    }


}
